{include file='admin/header.html' act="ok"}
	  <span class="td4"> 
        <div class="botline"></div>
        <div class="filtrs"> Фильтр 
            <form method="post" action="{geturl action='tenders'}" id="filter-form">
               
                    <select name='cats_filter[]' id='cats_filter' data-placeholder="Выбрать категорию" class="chosen-select_cat" multiple style="width:150px;" tabindex="4">
                        <option value="0" ></option>
                        {foreach from=$cats item=cat}
                        {if in_array($cat->getId(),$cats_filter)}
                        <option value="{$cat->getId()}" selected='selected'>{$cat->name}</option>
                        {else}
                        <option value="{$cat->getId()}">{$cat->name}</option>
                        {/if}
                        {/foreach}
                    </select>
                   
                    <select name='projects_filter[]' id='projects_filter' data-placeholder="Выбрать проект" class="chosen-select_project" multiple style="width:150px;" tabindex="4">
                        <option value='0'></option>
                        {foreach from=$projects item=project}
                        {if in_array($project->getId(), $projects_filter)}
                        <option value="{$project->getId()}" selected='selected'>{$project->name}</option>
                        {else}
                        <option value="{$project->getId()}">{$project->name}</option>
                        {/if}
                        {/foreach}
                    </select>
                   
                    <select name='archive_filter' id='projects_filter' data-placeholder="Показывать все" class="chosen-select_project" style="width:150px;" tabindex="4">
                        {if $archive_filter == ''}
                        <option value="2" selected='selected'>Все</option>
                        {else}
                        <option value="2">Все</option>
                        {/if}

                        {if $archive_filter == 0}
                        <option value="0" selected='selected'>Активные</option>
                        {else}
                        <option value="0">Активные</option>
                        {/if}

                        {if $archive_filter == 1}
                        <option value="1" selected='selected'>Не активные</option>
                        {else}
                        <option value="1">Не активные</option>
                        {/if}

                    </select>   
                 
                   <button type="submit" class="send">Фильтр</button>
              
            </form>
             <br>   
   Поиск<form method="post" action="{geturl action='tenders'}" id="filter-form" style="margin-left:63px;">
      
                  <input type="text" id="form_search" name="search" value="Поиск" onfocus="if (this.value=='Поиск') this.value=''" onblur="if (this.value==''){ldelim}this.value='Поиск'{rdelim}" style="width:455px"/>
            
         <button type="submit" class="send" >Поиск</button>
   </form>
           <!-- <br>
         
            {if $sort=='name'}
            <a href="?sort=name&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Имя</a>
            {else}
            <a href="?sort=name&order={if $order=='desc'}asc{else}desc{/if}">Имя</a>
            {/if}
      
            {if $sort=='start_date'}
            <a href="?sort=start_date&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Дата добавления</a>
            {else}
            <a href="?sort=start_date&order={if $order=='desc'}asc{else}desc{/if}">Дата добавления</a>
            {/if}
      
             {if $sort=='end_date'}
            <a href="?sort=end_date&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Дата окончания</a>
            {else}
            <a href="?sort=end_date&order={if $order=='desc'}asc{else}desc{/if}">Дата окончания</a>
            {/if}
            
            {if $sort=='archive'}
            <a href="?sort=archive&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Архив</a>
            {else}
            <a href="?sort=archive&order={if $order=='desc'}asc{else}desc{/if}">Архив</a>
            {/if}-->
           
   </div>
       
{foreach from=$tenders item=tender}


        <div class="tenders" id="tr_{$tender->getId()}"> 
          <div class="txttenders"> 
            <h2><a href="/tender/{$tender->getId()}" id="name_{$tender->getId()}">
              {if $tender->winner->getId() > 0}<img src="/images/winner-cup.png" alt="Завершен">{/if}      {$tender->name}</a></h2>
            <p><span>Проект:</span> {$tender->project->name}</p>
            <p><span>Ответственный: </span>{$tender->manager}</p>
            <p><span>Начало: </span>{$tender->start_date|date_format:"%d %B %Y (%H:%M)"}</p>
            <p><span>Окончание: </span>{$tender->end_date|date_format:"%d %B %Y (%H:%M)"}</p>
            {if $tender->archive == '0'} 
                <span class="inact" id="act_{$tender->getId()}">Активен</span>
            {else}
              <span class="nonact" id="act_{$tender->getId()}">в архиве</span>
            {/if}
           
            <a href="{geturl route='tendermembers' id=$tender->getId()}" class="spisok">Список   участников</a> </div>
          <div class="linktenders"> 
             <a href="{geturl route='edittender' id=$tender->getId()}" class="redact">Редактировать</a> 
            <a onclick="archivetender({$tender->getId()},{$tender->archive});" id="arch_{$tender->getId()}" class="arhiv">{if $tender->archive == '0'}В архив{else}Из архива{/if}</a> 
            <a onclick="deletetender({$tender->getId()});" style="cursor: pointer" class="dels">Удалить</a> 
            <!--<input type='text' class='form_end_date' id='update_{$tender->getId()}' style='width:70px;'>-->
            <!-- Не доработан --><a onclick='updatedate({$tender->getId()})' class="prodlit">Продлить</a> </div>
          <div class="clear"></div>
        </div>
{/foreach}
{if $pages != 1}
        <div class="pages">
            {section loop=$pages name=page}
                {assign var=p value=$smarty.section.page.index_next}
                {if $p == $page}
                    <span>{$p}</span>
                {else}
                   {if $p==1}
                    <a href="{geturl action='tenders'}">{$p}</a>
                    {else}
                     <a href="{geturl action='tenders'}?p={$p}">{$p}</a>
                    {/if}
              
                  
                {/if}
            {/section}
        </div>
{/if}
        </span>
{literal}
<script>
$(document).ready(function() {
   // $("#alertify-text").live('focus', function(){alert();$(this).datepicker({dateFormat: "yy-mm-dd"});});
    });
</script>
 {/literal}

{include file='admin/footer.html'  menu="tenders"}